﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace ModelSerialize
{
    public static class ArrayEx
    {
        public static T[] Sub<T>(this T[] list, long start, long length)
        {
            if (list.Length < start + length || start < 0 || length < 0)
                throw new Exception("截取范围值不合理");

            T[] temp = new T[length];

            Array.Copy(list, start, temp, 0, length);

            return temp;
        }

        public static Int64 ConvertToInt64(this byte[] bytes)
        {
            return BitConverter.ToInt64(bytes, 0);
        }
    }
}
